package com.infore.qualityControl.export.policy.strategy.concreteStrategy;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.infore.qualityControl.export.policy.bo.ExportParamBo;
import com.infore.qualityControl.export.policy.strategy.Strategy;
import com.infore.qualityControl.export.util.ExportUtil;
import com.infore.qualityControl.service.ITestDataService;
import com.infore.qualityControl.util.ObjectMapperUtil;
import com.infore.qualityControl.util.ResultEntity;

@Service("REAL_WATER_DATA")
public class RealWaterStrategy implements Strategy {
    
    @Autowired
    ITestDataService ITestDataService;
    
    @Autowired
    ObjectMapperUtil ObjectMapperUtil;

    @Override
    public byte[] doExcelStrategy(List<Map<String, Object>> list, ExportParamBo exportParamBo) throws Exception {
    	ResultEntity resultEntity = ITestDataService.realWaterSampleComparisonData(exportParamBo.getQualityParamSelectBo(), exportParamBo.getPageObject());
		if (exportParamBo.getIfCurrentSection()) { // 当前断面走特殊表格导出接口
			return ExportUtil.exportSpecialExcel(exportParamBo.getRequest(), exportParamBo.getHeaderProp(), exportParamBo.getPattern(), exportParamBo.getTableType(), resultEntity);
		} else {
			list = ObjectMapperUtil.convertListMap(resultEntity);
		}
		return ExportUtil.exportExcel(exportParamBo.getRequest(), list, exportParamBo.getHeaderProp(), exportParamBo.getPattern());
    }

    @Override
    public byte[] doPdfStrategy(List<Map<String, Object>> list, ExportParamBo exportParamBo) throws Exception {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public byte[] doWordStrategy(List<Map<String, Object>> list, ExportParamBo exportParamBo) throws Exception {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public List<Map<String, Object>> doData(List<Map<String, Object>> list, ExportParamBo exportParamBo) throws Exception {
        // TODO Auto-generated method stub
        return null;
    }

}
